package com.lyj.sc.dynamicProgramming.test420220721;

/**
 * @program: code-random
 * @description:
 * @author: lyj
 * @create: 2022-07-21 18:41
 * @version: 1.0
 * @Modifier By:
 **/
public class Solution {
    // 377. 组合总和 Ⅳ
    public int combinationSum4(int[] nums, int target) {
        int[]dp = new int[target+1];
        dp[0]=1;
        for (int i = 0; i <=target; i++) {
            for (int j = 0; j < nums.length; j++) {
                if(i>=nums[j]){
                    dp[i]+=dp[i-nums[j]];
                }
            }
        }
        return dp[target];
    }
}
